/**
 * Opens a BufferedReader and provides an interface
 * to take the contents of a particular file stored locally.
 * 
 * @author Chris Baillie.
 */

package application;
import java.io.BufferedReader;
import java.io.FileReader;

public class Reader {

	//Instance Variables
	BufferedReader br;
	
	public Reader(String filename)
	{
		try{
			br = new BufferedReader(new FileReader(filename));
			System.out.println("File opened...");
		} catch(Exception e){
			System.err.println("File Error: ");
			e.printStackTrace();
		}
	}
	
	public String getFileContents()
	{
		System.out.println("Let's get the File contents!");
		String contents="",temp="";
		try{
			temp += br.readLine();
		}catch(Exception e){
			System.err.println("File reading error: ");
			e.printStackTrace();
		}
		while(!temp.equals(null)){
			try {
				if(!temp.equals(""))
					contents += temp;
				temp = br.readLine();
			}catch(Exception e){
				System.err.println("File reading error: ");
				e.printStackTrace();
			}
		}
		System.out.println("Returning...");
		return contents;
	}
}
